package com.gegao.TempletMethodPattern;

/**
 * Created by zhangzhanzhong on 2015/12/30.
 */
public abstract class Account {

    protected boolean validate(String count, String password) {

        if (count != null && password != null) {
            System.out.printf("账号:%s\n", count);
            System.out.printf("密码:%s\n", password);

            if (count.equals("张无忌") && password.equals("123456")) {
                return true;
            }
        }
        return false;
    }

    protected abstract void calculateInterest();

    protected void show() {
        System.out.println("显示利息");
    }

    public void handl(String count, String password) {
        if (!validate(count, password)) {
            System.out.println("账户或密码错误");
            return;
        }
        calculateInterest();
        show();

    }
}
